/*
 * Created on Jun 12, 2005
 */
package org.vectrics.hibernate;


import org.hibernate.Session;
import org.hibernate.Transaction;
import org.vectrics.SystemException;
import org.vectrics.user.Person;

/**
 * @author MMoore
 */
public class HibernateTransaction {
	private Transaction transaction = null;
	private TransactionToken token = new TransactionToken();
	private Session session = null;
	
	/**
	 * 
	 */
	public HibernateTransaction(Session session, Transaction transaction) {
		super();
		this.setSession(session);
		this.setTransaction(transaction);
	}

	/**
	 * @return Returns the transaction.
	 */
	public Transaction getTransaction() {
		return transaction;
	}
	/**
	 * @param transaction The transaction to set.
	 */
	private void setTransaction(Transaction transaction) {
		if (transaction == null)
			throw new SystemException("Attempt to assign null transaction");
		this.transaction = transaction;
	}
	
	
	/**
	 * @return Returns the token.
	 */
	public TransactionToken getToken() {
		return token;
	}
	/**
	 * @param token The token to set.
	 */
	public void setToken(TransactionToken token) {
		this.token = token;
	}

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public String toString() {
		return("hibernateSession=" + this.session
				+ "|hibernateTransaction" + this.transaction
				+ "|token=" + this.token);
	}
}
